import Main from '@/components/main'
import parentView from '@/components/parent-view'

/**
 * iview-admin中meta除了原生参数外可配置的参数:
 * meta: {
 *  title: { String|Number|Function }
 *         显示在侧边栏、面包屑和标签栏的文字
 *         使用'{{ 多语言字段 }}'形式结合多语言使用，例子看多语言的路由配置;
 *         可以传入一个回调函数，参数是当前路由对象，例子看动态路由和带参路由
 *  hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
 *  notCache: (false) 设为true后页面不会缓存
 *  access: (null) 可访问该页面的权限数组，当前路由设置的权限会影响子路由
 *  icon: (-) 该页面在左侧菜单、面包屑和标签导航处显示的图标，如果是自定义图标，需要在图标名称前加下划线'_'
 *  beforeCloseName: (-) 设置该字段，则在关闭当前tab页时会去'@/router/before-close.js'里寻找该字段名对应的方法，作为关闭前的钩子函数
 * }
 */

export default [
  {
    path: '/login',
    name: 'login',
    meta: {
      title: 'Login - 登录',
      hideInMenu: true
    },
    component: () => import('@/view/login/login.vue')
  },
  // ************** 以下是只有一个下级导航的路由
  {
    path: '/',
    name: '_index',
    redirect: '/index',
    component: Main,
    meta: {
      hideInMenu: true,
      notCache: true
    },
    children: [
      {
        path: '/home',
        name: 'home',
        redirect: '/room_manage',
        meta: {
          hideInMenu: true,
          title: '首页',
          notCache: true,
          icon: 'md-home'
        },
        component: () => import('@/view/single-page/home')
      }]
  },
  // ************** 以下是跳转到第三方网站的路由配置
  {
    path: '/web-index',
    name: 'web-index',
    redirect: '/index-request',
    meta: {
      title: '首页',
      icon: 'ios-book',
      hideInMenu: true
    }
  },

  // ****************以下是独立页面
  {
    path: '/401',
    name: 'error_401',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/401.vue')
  },
  {
    path: '/500',
    name: 'error_500',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/500.vue')
  },
  {
    path: '*',
    name: 'error_404',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/404.vue')
  },

  // *******************网上答疑系统页面*****************
  // ******************答疑室管理*****************
  {
    path: '/_room_manage',
    name: '_room_manage',
    redirect: '/room_manage',
    component: Main,
    meta: {
      icon: 'md-funnel',
      title: '答疑室管理',
      access: ['admin.rm'],
      notCache: true
    },
    children: [
      { // 角色权限
        path: '/room_manage',
        name: 'room_manage',
        meta: {
          icon: 'md-funnel',
          title: '答疑室',
          access: ['admin.rm']
        // showAlways: true,
        },
        component: () => import('@/view/ora-admin/ra-room/RoomManage.vue')
      }]
  },

  // ************用户管理************/
  {
    path: '/uers_manage',
    name: 'uers_manage',
    meta: {
      icon: 'md-menu',
      title: '用户管理'
    },
    component: Main,
    children: [
      {
        path: 'user',
        name: 'user',
        meta: {
          icon: 'md-funnel',
          title: '普通用户',
          access: ['admin.um.user']
        },
        component: () => import('@/view/ora-admin/user-manage/User.vue')
      },
      {
        path: 'admin',
        name: 'admin',
        meta: {
          icon: 'md-funnel',
          title: '管理员',
          access: ['admin.um.admin']
        },
        component: () => import('@/view/ora-admin/user-manage/Admin.vue')
      }]
  },

  // **************专业课程***************/
  {
    path: '/profession_course',
    name: 'profession_course',
    meta: {
      icon: 'md-menu',
      title: '专业课程',
      access: ['admin.pc']
    },
    component: Main,
    children: [
      {
        path: 'profession',
        name: 'profession',
        meta: {
          icon: 'md-funnel',
          title: '专业管理',
          access: ['admin.pc.profession']
        },
        component: () => import('@/view/ora-admin/profession-course/Profession.vue')
      },
      {
        path: 'course',
        name: 'course',
        meta: {
          icon: 'md-funnel',
          title: '课程管理',
          access: ['admin.pc.course']
        },
        component: () => import('@/view/ora-admin/profession-course/Course.vue')
      }]
  },
  /** =================问题管理================== */
  {
    path: '/request_report',
    name: 'request_report',
    meta: {
      icon: 'md-menu',
      title: '问答管理',
      access: ['admin.rm']
    },
    component: Main,
    children: [
      {
        path: '/handle_report',
        name: 'handle_report',
        meta: {
          icon: 'md-funnel',
          title: '举报处理',
          access: ['admin.rm.report']
        // showAlways: true,
        },
        component: () => import('@/view/ora-admin/request-answer/ReportHandle.vue')
      },
      {
        path: '/request_manage',
        name: 'request_manage',
        meta: {
          icon: 'md-funnel',
          title: '问题管理',
          access: ['admin.rm.request']
        },
        component: () => import('@/view/ora-admin/request-answer/RequestManage.vue')
      }]
  },
  /** =================系统设置================== */
  {
    path: '/role_manage',
    name: 'role_nanage',
    redirect: '/role_resource',
    component: Main,
    meta: {
      icon: 'md-funnel',
      title: '角色权限',
      access: ['admin.rs']
    },
    children: [
      { // 角色权限
        path: '/role_resource',
        name: 'role_resource',
        meta: {
          icon: 'md-funnel',
          title: '角色权限'
        // showAlways: true,
        },
        component: () => import('@/view/ora-admin/role-resource/RoleResource.vue')
      }]
  },
  /** ================首页================ */
  {
    path: '/index',
    name: 'index',
    redirect: '/index-request',
    meta: {
      title: '首页',
      icon: 'md-funnel',
      hideInMenu: true
      // notCache: true
    },
    component: () => import('@/view/ora-web/index/Main.vue'),
    children: [
      // 主页-提问
      {
        path: '/index-request',
        name: 'index-request',
        meta: {
          hideInMenu: true,
          icon: 'md-funnel',
          title: '主页-提问'
        },
        component: () => import('@/view/ora-web/index/index.vue')
      },
      // 主页答疑室
      {
        path: '/answer-room',
        name: 'answer-room',
        meta: {
          hideInMenu: true,
          icon: 'md-funnel',
          title: '主页-答疑室'
        },
        component: () => import('@/view/ora-web/requst-answer-room/room-list/RoomList.vue')
      },
      // 答疑室详情页
      {
        path: '/answer-room-details/:roomId',
        name: 'answer-room-details',
        meta: {
          hideInMenu: true,
          icon: 'md-funnel',
          title: '答疑室详情页'
        },
        props: true,
        component: () => import('@/view/ora-web/requst-answer-room/room-details/RoomDetails.vue')
      },

      // **************** 问答模块 ******************/
      {
        path: '/request',
        name: 'request',
        meta: {
          hideInMenu: true,
          title: '提问',
          icon: 'md-funnel',
          notCache: true
        },
        component: () => import('@/view/ora-web/Request.vue')
      },
      // 问题列表
      {
        path: '/requestList',
        name: 'requestList',
        meta: {
          hideInMenu: true,
          icon: 'md-funnel',
          title: '问题列表'
        },
        component: () => import('@/view/ora-web/RequestList.vue')
      },
      {
        path: '/answer/:requestId',
        name: 'answer',
        meta: {
          title: '回答',
          icon: 'md-funnel'
        },
        component: () => import('@/view/ora-web/Answer.vue'),
        props: true
      },
      {
        path: '/user-main',
        name: 'user-main',
        redirect: '/user-center',
        meta: {
          title: '用户主页',
          icon: 'md-funnel'
        },
        component: () => import('@/view/ora-web/user-main/Main.vue'),
        children: [
          {
            path: '/user-info',
            name: 'user-info',
            meta: {
              title: '用户信息',
              icon: 'md-funnel'
            },
            component: () => import('@/view/ora-web/user-main/UserInfo.vue')
          },
          {
            path: '/user-center',
            name: 'user-center',
            meta: {
              title: '用户主页',
              icon: 'md-funnel'
            },
            component: () => import('@/view/ora-web/user-main/user-center/UserCenter.vue')
          }]
      }
    ]
  }
]
